/**
 *
 * Copyright (c) 2012 NCS Corporation.
 *
 * Author: tangb
 * Created Date: May 30, 2012
 * 
 * 	version					author					remark
 * 	1.0						tangb				
 */
package com.ocgs.base.core.util;

import org.springframework.context.ApplicationContext;

public class ApplicationContextHolder {

	private static ApplicationContext appContext;

	public static ApplicationContext getAppContext() {
		return appContext;
	}

	public static void setAppContext(ApplicationContext appContext) {
		ApplicationContextHolder.appContext = appContext;
	}

	public static <T> T getBean(String name, Class<T> requiredType) {
		return appContext.getBean(name, requiredType);
	}

	public static <T> T getBean(Class<T> requiredType) {
		return appContext.getBean(requiredType.getName(), requiredType);
	}

}
